package com.card323.crpg.io.msn;

import com.card323.crpg.io.MessageReceiver;

public class MSNMessageReceiver implements MessageReceiver {
	private volatile String _message;
	private volatile boolean _is_waiting_message;

	public synchronized boolean is_waiting_message() {
		return _is_waiting_message;
	}

	public synchronized String get_message() {
		_message = null;
		_is_waiting_message = true;
		try {
			while (_message == null)
				wait();
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		return _message;
	}

	public synchronized void set_message(String content) {
		_message = content;
		_is_waiting_message=false;
		notifyAll();
	}
}
